import Vue from "vue";
import Vuex from "vuex";

Vue.use(Vuex);

export default new Vuex.Store({
  state: {
    isloginBox: false,
    islogin: {
      flag: false,
      userName: "未登录"
    },
    searchInputText: ""
  },
  mutations: {
    changeIsLoginBox(state, status) {
      state.isloginBox = status;
    },
    changeIsLogin(state, status) {
      state.islogin = status;
      localStorage.setItem("isLoginFlag", status.flag);
      localStorage.setItem("isLoginUserName", status.userName);
    },
    changeSearchInputText(state, content) {
      state.searchInputText = content;
    }
  },
  actions: {},
  modules: {}
});
